#include "str_to_double.h"
#include <sstream>
#include <stdexcept>
double str_to_double(const std::string &s)
{
    std::istringstream iss(s);
    double d;
    iss >> d;
    if (!iss)
    {
        throw std::runtime_error("double format error: " + s);
    }
    return d;
}